<template>
  <div>
    <van-tabs v-model="active" color="#1989FA" title-active-color="#1989FA" sticky swipeab :ellipsis="false" line-width="70px" title-inactive-color="#000">
      <van-tab title="国内出差申请">
        <domestic></domestic>
      </van-tab>
      <!-- <van-tab title="阿国出差申请" > -->
      <van-tab title="阿国出差申请" v-if="fileRole(['阿国职员', '审批人'])">
        <a-country ></a-country>
      </van-tab>
      <van-tab title="第三国出差申请">
        <tcountry></tcountry>
      </van-tab>
       <!-- <van-tab title="上传图片"> -->
       <van-tab title="上传图片" v-if="fileRole(['审批人'])">
        <updateimg></updateimg>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import domestic from './components/Domestic.vue'
import ACountry from './components/ACountry.vue'
import tcountry from './components/ThirdCountry.vue'
import updateimg from './components/UpdateImg.vue'
export default {
  components: {
    domestic,
    ACountry,
    tcountry,
    updateimg
  },
  data(){
    return{
      role: JSON.parse(sessionStorage.getItem('role')),
      active: 0 
    }
  },
  methods: {
    fileRole(val=0){
      var valid = false;
      for(let i = 0; i < val.length; i++){
        for(let j = 0; j< this.role.length; j++){
          if(val[i] === this.role[j])
            valid = true;
        }
      }
      return valid;
    },
  },
  created(){
   
  }
}
</script>
